Add .asRegExp()
method to return regexp for route
#27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm using
route-parser
in my react app, and it's working great, thank you!And my local dev server is serving 2 single-page apps using connect-history-api-fallback to determine which one to serve based on the URL.
Thus far I've manually crafted a regexp, then moved on to writing my own route-parser route -> regexp parser, and quickly decided that was a bit silly since route-parser can give me the regular expressions.
So here I am with a PR to expose the regexp on the route.
I'm interested to know what your thoughts on this are. Personally I'm happy to continue using the regexp visitor in my code, but I'd feel better knowing that was stable/documented. I'm happy to submit a PR for docs instead.
Another solution would be to modify connect-history-api-fallback to accept a function in place of a regexp. But I'm not a direct consumer of that module. Rather I'm using webpack-dev-server, which uses that under the hood.